<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PageContext对象实例</title>
</head>
<body>
<%
	//设置一个属性name，其值为PageContext。取值范围为request
	//获取request对象
	HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
	//设置page范围内属性
	pageContext.setAttribute("str", "Java",pageContext.PAGE_SCOPE);
	//设置request范围内属性
	req.setAttribute("str", "Java Web");
	//获得的page范围属性
	String str1 = (String)pageContext.getAttribute("str", pageContext.PAGE_SCOPE);
	//获得的request范围属性
	String str2 = (String)pageContext.getAttribute("str", pageContext.REQUEST_SCOPE);
%>
<%="page范围："+str1 %><br />
<%="request范围："+str2 %><br />
<%
/*pageContext.setAttribute("name","PageContext对象",pageContext.REQUEST_SCOPE);
	pageContext.forward("TestPageContext.jsp");*/
%>
</body>
</html>
